﻿using System.Linq;
using HtmlAgilityPack;
using NUnit.Framework;
using Fizzler.Systems.HtmlAgilityPack;

namespace HtmlDeploy.Test
{
    [TestFixture]
    public class MasterPageFixture
    {
        [Test]
        public void ItWorks()
        {
            var masterPage = new MasterPage(@"Views\Shared\", @"Views\Sample");
            var compiled = masterPage.Compile();

            var html = new HtmlDocument();
            html.LoadHtml(compiled.First().Value);

            Assert.That(html.DocumentNode.QuerySelectorAll("#mainContent1").Count(), Is.EqualTo(1));
            Assert.That(compiled.First().Value.Contains(@"<input type=""text"" name=""shoudlNotTrim"" />"));
        }

        [Test]
        public void Test2()
        {
            var masterPage = new MasterPage(@"C:\opensourced\HtmlDeploy\src\HtmlDeployTask.Test\MasterPages\", @"C:\opensourced\HtmlDeploy\src\HtmlDeployTask.Test\Views\");
            var compiled = masterPage.Compile();

            var html = new HtmlDocument();
            html.LoadHtml(compiled.First().Value);

            Assert.That(html.DocumentNode.QuerySelectorAll("#mainContent1").Count(), Is.EqualTo(1));
            Assert.That(compiled.First().Value.Contains(@"<input type=""text"" name=""shoudlNotTrim"" />"));
        }
    }
}
